public class RemoveDuplicates {
    public int removeDuplicates(int[] nums){
        int count=nums.length;
        if(count==0){
           return 0;
        }
        int slow=1,fast=1;
        while (fast<count){
        if (nums[fast]!=nums[fast-1]) {
            nums[slow]=nums[fast];
            ++slow;
        }
        ++fast;
    }return slow;
}
}
